<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<%
	try {
		Class.forName("com.mysql.jdbc.Driver");
		
		String url = "jdbc:mysql://localhost:3306/world";
		String username = "leon";
		String password = "123456";
		Connection conn = DriverManager.getConnection(url, username, password);
		if (conn != null) {
			out.println("连接数据库ok!");
		} else {
			out.println("连接数据库失败");
		}
	} catch (ClassNotFoundException e) {
		e.printStackTrace();
	} catch (SQLException e) {
		e.printStackTrace();
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Hello World</title>
<script type="text/javascript" src="js/jquery-2.1.4.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$("a").click(function(){
			alert("jquery处理点击");
		});
	});
</script>
</head>
<body>
Hello World!
你好<br>
<% String[] bookName = new String[] {"book1", "book2", "book3"}; %>
<table border="8" align="center">
	<tr>
		<td>编号</td>
		<td>书名</td>
	</tr>
	<% for (int i = 0; i < bookName.length; i++) { %>
	<tr>
		<td><%= i %></td>
		<td><%= bookName[i] %></td>
	</tr>
	<% } %>
</table>
<form action="logon.jsp" method="get">
	<ul>
	<li>用户名: <input type="text" name="username"></li>
	<li>密&nbsp;码: <input type="password" name="password"></li>
	<li><input type="submit" value="提交"></li>
	</ul>
</form>
<form action="dosubmit.jsp">
	<table border="2">
		<tr align="center">
			<td colspan="2">选择操作</td>
		</tr>
		<tr>
			<td>
				<input type="image" name="logon" src="http://localhost:8080/HelloWorld/image/logon.gif">
			</td>
			<td>
				<input type="image" name="reg" src="image/reg.gif">
			</td>
		</tr>
	</table>
</form>
<a href="#">弹出对话框</a>
</body>
</html>